

import { htmlSystem, $utils, fileSystem } from "@/utils";
import { createHtmlTemp } from '@/config'
const importHandler = () => {
    $utils.clearStorage("bookmarks");
    $utils.setStorage("hadInfo", true);
    location.reload();
}
const clearHandler = () => {
    $utils.clearStorage("bookmarks");
    $utils.clearStorage("hadInfo");
    location.reload();
}
const exportHandler = () => {
    const bookmarks = $utils.getStorage("bookmarks");
    const htmlStr = htmlSystem.initJSON(bookmarks)
    const htmlTemp = createHtmlTemp('bookmark')
    const targetFile = fileSystem.stringToBlobURL(htmlTemp + htmlStr)
    fileSystem.downloadFile(targetFile, 'bookmarks.html');
}
export const dropConfig = [{
    label: "初始化书签",
    handler: clearHandler
}, {
    label: "导出书签",
    handler: exportHandler
}, {
    label: "导入书签",
    handler: importHandler
},]

